package eventConfig;
import java.awt.event.*;

import javax.swing.SwingUtilities;
public class MouseEventSetUp extends MouseAdapter{
	
	public void leftButtonPressed(MouseEvent mouseEvent){
		System.out.println("Method Called for Left Mouse Button Press.");
	}
	public void middleButtonPressed(){
		System.out.println("Method Called for Middle Mouse Button Press.");
	}
	public void rightButtonPressed(){
		System.out.println("Method Called for Right Mouse Button Press.");
	}
	
	public void leftButtonReleased(){
		System.out.println("Method Called for Left Mouse Button Released.");
	}
	public void middleButtonReleased(){
		System.out.println("Method Called for Middle Mouse Button Released.");
	}
	public void rightButtonReleased(){
		System.out.println("Method Called for Right Mouse Button Released.");
	}
	
	public void mousePressed(MouseEvent mouseEvents){
		int modifiers = mouseEvents.getModifiers();
		if ((modifiers & InputEvent.BUTTON1_MASK)== InputEvent.BUTTON1_MASK){
			leftButtonPressed(mouseEvents);
		}
		if ((modifiers & InputEvent.BUTTON2_MASK)== InputEvent.BUTTON2_MASK){
			middleButtonPressed();
		}
		if ((modifiers & InputEvent.BUTTON3_MASK)== InputEvent.BUTTON3_MASK){
			rightButtonPressed();
		}
	}
	
	public void mouseReleased(MouseEvent mouseEvents){
		if (SwingUtilities.isLeftMouseButton(mouseEvents)){
			leftButtonReleased();	
		}
		if (SwingUtilities.isMiddleMouseButton(mouseEvents)){
			middleButtonReleased();	
		}
		if (SwingUtilities.isRightMouseButton(mouseEvents)){
			rightButtonReleased();	
		}
	}		
}

